<?php

namespace backend\controllers;

use Yii;
use backend\models\AdminModel;
class CommenController extends \yii\web\Controller
{

	public function init()
	{
		$session = Yii::$app->session;
		if(!$session['content']['name'])
		{
			echo "<script>location.href='index.php?r=adminlogin/index'</script>";
			exit;			
		}
		else
		{
			$q=AdminModel::find();
			$q->where = "admin_user = '".$session['content']['name']."' and admin_id = '".$session['content']['id']."'";
			$id=$q->one();
			if(!$id)
			{
				echo "<script>location.href='index.php?r=adminlogin/index'</script>";
				exit;	
			}	
		}
	} 
}
